function validateIssueForm()
{
	var xmlhttp;
	
	var user = document.getElementById("user").value;
	var badge = document.getElementById("badge").value;
	
	if (user == "" || badge == "") {
		
		if (user == "")
			document.getElementById("message").innerHTML = "È necessario selezionare un utente";
		
		if (badge == "")			
			document.getElementById("message").innerHTML = "È necessario selezionare una badge";
		
		document.getElementById("issue").disabled = true;
		return;
	}
	
	user = user.split('#');
	badge = badge.split('#');
	
	if (window.XMLHttpRequest) // code for IE7+, Firefox, Chrome, Opera, Safari
	{ 
		xmlhttp = new XMLHttpRequest();
	}
	else // code for IE6, IE5
	{ 
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
		{
			$response = xmlhttp.responseText;
			if (!strcmp($response, "ERR")) {
				document.getElementById("message").innerHTML = "Impossibile verificare se " + 
				"l'utente ha già ottenuto la badge selezionata";
				document.getElementById("issue").disabled = false;
			} else if (!strcmp($response, "KO")) {
				document.getElementById("message").innerHTML = "L'utente selezionato " + 
				"ha già ottenuto la badge selezionata";
				document.getElementById("issue").disabled = true;
			} else {
				document.getElementById("message").innerHTML = "";
				document.getElementById("issue").disabled = false;
			}
		}
	}

	xmlhttp.open("GET", "php/ajax/verify_issue.php?b=" + badge[0] + "&u=" + user[0], true);
	xmlhttp.send();
}
